package com.shop2cn.iapi.promotion.parameter;

import com.google.gson.annotations.SerializedName;
import com.ymt.base.BaseBean;

import java.math.BigDecimal;
import java.util.UUID;

/**
 * Created by gejianhua on 2017/5/10.
 * 购物车商品
 */
public class ProductDto extends  BaseBean {

    public ProductDto(){
    }
    /**
     * @param pid 商品id
     * @param cid 规格id
     * @param pup 商品单价
     * @param pq 商品数量
     * @param cur 商品币种 CNY USD JPY
     */
    public ProductDto(String pid,String cid,Double pup,Integer pq,String cur){
    	this.productId=pid;
    	this.catalogId=cid;
    	this.productUnitPrice=BigDecimal.valueOf(pup);
    	this.productQty=pq;
    	this.currency=cur;
    }

    /**
     * 购物车商品序号
     */
    private String shoppingCartProductNo;


    /**
     * 商品ID，uuid
     */
    @SerializedName("ProductId")
    private String productId;

    /**
     * 商品规格Id
     */
    @SerializedName("CatalogId")
    private String catalogId;

    /**
     * 单价
     */
    @SerializedName("ProductUnitPrice")
    private BigDecimal productUnitPrice;

    /**
     * 购买数量
     */
    @SerializedName("ProductQty")
    private Integer productQty;

    /**
     * 商品总价
     */
    @SerializedName("ProductTotalPrice")
    private BigDecimal productTotalPrice;

    /**
     * 优惠金额
     */
    @SerializedName("PromotionValue")
    private BigDecimal promotionValue;

    /**
     * 是否得到了优惠促销
     */
    private Boolean promotion;
    /**
     * 币种
     */
    private String currency;
    /**
     * 是否免运费  true:免运费  false:不免运费  新增 summing 20191231
     */
    private boolean freeFreight;




    public String getProductId() {
        return productId;
    }

    public void setProductId(String productId) {
        this.productId = productId;
    }

    public String getCatalogId() {
        return catalogId;
    }

    public void setCatalogId(String catalogId) {
        this.catalogId = catalogId;
    }

    public BigDecimal getProductUnitPrice() {
        return productUnitPrice;
    }

    public void setProductUnitPrice(BigDecimal productUnitPrice) {
        this.productUnitPrice = productUnitPrice;
    }

    public int getProductQty() {
        return productQty;
    }

    public void setProductQty(int productQty) {
        this.productQty = productQty;
    }

    public BigDecimal getProductTotalPrice() {
//        if(this.productUnitPrice == null){
//            this.productTotalPrice = null;
//            return this.productTotalPrice;
//        }
//        this.productTotalPrice = this.productUnitPrice.multiply(new BigDecimal(this.productQty));
        return this.productTotalPrice;
    }

    public void setProductTotalPrice(BigDecimal productTotalPrice) {
        this.productTotalPrice = productTotalPrice;
    }

    public BigDecimal getPromotionValue() {
        return promotionValue;
    }

    public void setPromotionValue(BigDecimal promotionValue) {
        this.promotionValue = promotionValue;
    }

    public Boolean getPromotion() {
        return promotion;
    }

    public void setPromotion(Boolean promotion) {
        this.promotion = promotion;
    }

    public String getShoppingCartProductNo() {
//        if(this.shoppingCartProductNo == null){
//            this.shoppingCartProductNo = UUID.randomUUID().toString();
//        }
        return shoppingCartProductNo;
    }

    public void setShoppingCartProductNo(String shoppingCartProductNo) {
        this.shoppingCartProductNo = shoppingCartProductNo;
    }

    public String getCurrency() {
        return currency;
    }

    public void setCurrency(String currency) {
        this.currency = currency;
    }
    
    
    
    public boolean getfreeFreight() {
        return freeFreight;
    }

    public void setfreeFreight(boolean freeFreight) {
        this.freeFreight = freeFreight;
    }
}
